<%@ page import="entity.User" %><%--
  Created by IntelliJ IDEA.
  User: yangrunke
  Date: 2024/7/25
  Time: 上午10:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
//    Cookie[] cookies = request.getCookies();
//    String username=null;
//    if (cookies != null) {
//        for (Cookie cookie : cookies) {
//            if (cookie.getName().equals("username")) {
//                username=cookie.getValue();
//            }
//        }
//    }else{
//        response.sendRedirect("login.html");
//    }
    String username= request.getSession().getAttribute("username").toString();
    if (username == null) {
        response.sendRedirect("login.html");
    }
%>
<%--欢迎<%=username%>登录.<a href="/loginout">安全退出</a>--%>
欢迎${username}登录.<a href="/loginout">安全退出</a>
</body>
</html>
